package ar.uba.fi.RSACryptoFiuba.model;

import java.util.Observable;


public abstract class RSAAlgorithm extends Observable{
	
	private RSAMessage message;
	private RSAStep currentStep;
	private RSAAlgorithmStrategy strategy;
	
	public RSAAlgorithm(RSAAlgorithmStrategy strategy, RSAMessage message){
		this.strategy = strategy;
		this.message = message;
		this.init();
	}
		
	public abstract void init();

	public void movePreviousStep(){
		this.strategy.movePreviousStep(this);
	}
	
	public void moveNextStep(){
		this.strategy.moveNextStep(this);
	}

	public void reset() {
		this.strategy.reset(this);
	}

	public void undoStep() {
		this.strategy.undoStep(this);	
	}
	
	public void executeStep(){
		this.strategy.executeStep(this);
	}
	
	public void resolve(){
		this.strategy.resolve(this);
	}
	
	public RSAStep getCurrentStep(){
		return currentStep;
	}
	
	public void setCurrentStep(RSAStep currentStep){
		this.currentStep = currentStep;
	}
	
	public RSAMessage getMessage(){
		return message;
	}
	
	public void setMessage(RSAMessage message){
		this.message = message;
	}

	public RSAAlgorithmStrategy getStrategy() {
		return strategy;
	}

	public void setStrategy(RSAAlgorithmStrategy strategy) {
		this.strategy = strategy;
	}

}
